package user

import (
	"github.com/gin-gonic/gin"
	. "myplatform/handler/user"
	"myplatform/middleware"
)

func LoadUser(g *gin.Engine) {
	//stuV1.Use(middleware.AuthToken)  //为路由组添加中间件
	//登录注册
	g.GET("/register", RegisterHTML)
	g.POST("/register", Register)
	g.GET("/login", LoginHTML)
	g.POST("/login", Login)
	//根据token识别用户信息
	g.GET("/userinfo", middleware.AuthToken, GetUserProfile)
	g.POST("/userinfo", middleware.AuthToken, Adduserinfo)
	g.GET("/userinfoHTML", GetUserProfileHTML)

	g.GET("/user/post", middleware.AuthToken, GetPostByuid)
	g.GET("/user/postHTML", GetPostByuidHTML)
	//根据用户找收藏帖子
	g.GET("/user/postcollect", middleware.AuthToken, GetPostCollectByuser)
	g.GET("/user/postcollectHTML", GetPostCollectByuserHTML)

	//查询用户
	g.GET("/user", Getuser)
	g.GET("/user/searchkw", GetUserBykey)
	g.GET("/usermanageHTML", UsermanageHTML)

	//操作用户
	g.POST("/user/:id", Upuser)
	g.DELETE("/user/:id", Deluser)

}
